#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <stdexcept>

#include "MyStack.h"

using namespace std;

namespace MyStack {

void Stack::push(int const& elem)
{
    elems.push_back(elem);
}

void Stack::pop()
{
    if(elems.empty()) {
        throw out_of_range("Stack<>pop: out of range");
    }

    elems.pop_back();
}

int Stack::top() const
{
    if(elems.empty()) {
        throw out_of_range("Stack<>top: out of range");
    }

    int data;
    data = elems.back();
    
    return data;
}

}

